package di.ass.main;

import di.ass.R;
import di.ass.database.DatabaseHandler;
import di.ass.main.helps.HelpUse;
import di.ass.main.helps.HowToAdd;
import di.ass.main.helps.HowToDel;
import di.ass.main.helps.HowToEdit;
import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class Help extends TabActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setupTabs();
	}

	private void setupTabs() {
		String[] textHelp = null;
		DatabaseHandler db = new DatabaseHandler(this);
		// TODO Auto-generated method stub
		if (db.getLanguageUse().equals("Việt Nam")) {
			textHelp = getResources().getStringArray(R.array.helptab_vi);
		} else if (db.getLanguageUse().equals("English")) {
			textHelp = getResources().getStringArray(R.array.helptab_eng);
		}
		TabHost host = getTabHost();

		TabSpec spec1 = host.newTabSpec("help");
		Intent intent1 = new Intent(this, HelpUse.class);
		spec1.setIndicator(textHelp[0],
				getResources().getDrawable(R.drawable.help_list_icon));
		spec1.setContent(intent1);

		TabSpec spec2 = host.newTabSpec("howToAdd");
		Intent intent2 = new Intent(this, HowToAdd.class);
		spec2.setIndicator(textHelp[1],
				getResources().getDrawable(android.R.drawable.ic_menu_add));
		spec2.setContent(intent2);

		TabSpec spec3 = host.newTabSpec("howToEdit");
		Intent intent3 = new Intent(this, HowToEdit.class);
		spec3.setIndicator(textHelp[2],
				getResources().getDrawable(android.R.drawable.ic_menu_edit));
		spec3.setContent(intent3);

		TabSpec spec4 = host.newTabSpec("howToDel");
		Intent intent4 = new Intent(this, HowToDel.class);
		spec4.setIndicator(textHelp[3],
				getResources().getDrawable(android.R.drawable.ic_menu_delete));
		spec4.setContent(intent4);

		TabSpec spec5 = host.newTabSpec("about");
		Intent intent5 = new Intent(this, About.class);
		spec5.setIndicator(textHelp[4],
				getResources().getDrawable(android.R.drawable.ic_dialog_info));
		spec5.setContent(intent5);

		host.addTab(spec1);
		host.addTab(spec2);
		host.addTab(spec3);
		host.addTab(spec4);
		host.addTab(spec5);
	}
}